var rp;
function Rating(id, type, userNo,relPath) {
	rp=relPath||'';
	this.imgId=this.genImgId(id,type,userNo);
	var htmlTag=this.genHtml();
	document.getElementById(id).innerHTML=htmlTag;
}

Rating.prototype.genImgId = function() {
	var _id = '';
	for (var index = 0; index < arguments.length; index++) {
		_id += '_' + arguments[index];
	}
	return _id;
};
Rating.prototype.genHtml = function() {
	var step = 18;
	var htmlArray = [];
	var mapStart = "<MAP name=ratingmap>";
	var mapEnd = "</MAP>";
	for (var i = 1; i < 11; i++) {
		var str = "<AREA onmouseover=\"Rating.s('"+this.imgId+"'," + i + ");\" "
				+ "onclick=\"Rating.r('"+this.imgId+"');\" "
				+ "onmouseout=\"Rating.r('"+this.imgId+"');\" shape=CIRCLE coords="
				+ (10 + 18 * (i - 1)) + ",24,11>";
		htmlArray.push(str);
	}
	var imgHtml = "<IMG id='"
			+ this.imgId
			+ "'  onmouseout=\"Rating.r('"+this.imgId+"');\" src=\""+rp+"images/rating/0cherries.gif\"  useMap=#ratingmap border=0>"
	return mapStart + htmlArray.join('') + mapEnd + imgHtml;

}


Rating.r = function(imgId) {
	var obj = document.getElementById(imgId);
	obj.src = rp+'images/rating/0cherries.gif';
}

Rating.s = function(imgId,idx) {
	var obj = document.getElementById(imgId);
	obj.src =rp+ 'images/rating/' + idx + 'cherries.gif';
}